Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Access the CodeBase from your MetaTrader 5 terminal
Couldn't find the right code? Order it in the Freelance section
How to Write an Expert Advisor or an Indicator

MQL4 Source Code Library for MetaTrader 4

icon

The largest library features codes of free trading Expert Advisors, technical indicators and scripts. With the available applications you can trade in automated mode and analyze price dynamics. Use the library of codes to learn more about financial market sentiments.

Download free applications, test them and run in your MetaTrader 4. You can access them from the MetaTrader 4 platform and the MetaEditor development environment.

Submit your code

This EA will scan all the closed trades and then print the nth trade from the end

This EA will scan all the open trades and then print the nth trade from the end

This script will detect an end-of-trading day and notify

This script will scan all the open trades and then will close the biggest winning/losing trade

This script will place hedge trade of unbalanced type in MT4.

This script will close all active trades and delete pending orders based on the order type passed on the input.

This script will close all active trades sequentially. following the order in which they were opened

This script will calculate the total active and closed orders based on order types

Find the current winning / losing streak in MT4 based on filters

a very convenient way to filter out unnecessary signals of crossing levels

improved version of the standard Simple moving average indicator with a lower delay based on: https://www.mql5.com/en/code/30844 (author: https://www.mql5.com/en/users/mladen)

standart RSI with dynamic levels

This is a simple code to mimic onTradeTransaction Event handler defined in MQL5

Classic & Virtual Trailing for MT4

Virtual SL TP Pending with SL Trailing for Symbol Chart

This MQL4 EA is designed to close positions for a basket of currency pairs based on certain profit and loss thresholds.

Reverses all open trades after Closure for all symbols .

Trailing_StopLoss_for All_orders_and_symbols

Simple continuous trend-following strategy for buying and selling based on predefined conditions

Bars Pips for Chart Symbol and Period selected

Hedge Symbol 100%

Changing the size of the chart window is important in my EA, but it may serve as inspiration for others.

Open Charts

Simple banner showing Symbol Spread Equity Profit Banner

Orders Closure

Hedge with a stop order, instead of placing a Stop Loss.

Short description.

Short description.

Close_on_PROFIT_or_LOSS_inAccont_Currency

Hedge Dollar index USIDX against its constitutive FOREX pairs EURUSD GBPUSD USDJPY USDCAD USDSEK USDCHF

Break on Code Error ! This script is a general example of using error brake in any strategy.

simple trail stop loss code example.

This is an indicator to calculate 14 types of moving averages based on close price.

This is a indicator to plot hidden and regular divergences on chart.

Many Expert Advisors (EAs) tend to close orders at the take profit level, considering the pip distance from the purchase price.

[@Buy_Sell_Close] Manual trading EA for trading newbies, EA can be used in backtesting visual mode, EA can also be used in live trading. You can practice your own trading system in backtesting.

AVA adapts its analysis based on current market dynamics. This adaptability makes it invaluable for predicting shifts towards higher volatility or calmer periods.

this shortcode will calculate the drawdown of a particular ea, where it is applied to a specified symbol.

The Breakeven Point, or Titik Impas, denotes the price level at which a trade's profit becomes zero. By setting a position to Titik Impas Breakeven, the stop-loss is aligned with the position's opening price. This strategy proves valuable when you aim to allow profits to accumulate while ensuring that the trade remains secure and does not revert to negative territory.

Displays the gains and losses for all candles where the given threshold is surpassed. The values are calculated in points and percentage.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102